/**
 * Created by 立国 on 2014/3/25.
 */
package com.familybox.app {


    import com.familybox.app.services.AuthService;
    import com.familybox.app.services.IAuthService;
    import com.familybox.app.view.components.ContentView;
    import com.familybox.app.view.components.LoginView;
    import com.familybox.app.view.components.MainView;
    import com.familybox.app.view.mediators.ContentMediator;
    import com.familybox.app.view.mediators.LoginMediator;
    import com.familybox.app.view.mediators.MainMediator;

    import flash.display.DisplayObjectContainer;

    import org.robotlegs.core.IContext;
    import org.robotlegs.mvcs.Context;
    import org.robotlegs.oil.rest.IRestClient;
    import org.robotlegs.oil.rest.JSONClient;

    import spark.components.Application;


    public class ApplicationContext extends Context implements IContext {

        public function ApplicationContext(contextView:DisplayObjectContainer, autoStartup:Boolean = true) {
            super(contextView, autoStartup);
        }

        override public function startup():void {

            mapMembership();
            mapModel();
            mapService();
            mapView();
            mapController();

            (contextView as Application).addElement(new MainView());

            super.startup();
        }

        private function mapMembership():void {

        }

        private function mapModel():void {

        }

        private function mapService():void {
            injector.mapSingletonOf(IAuthService, AuthService);
        }

        private function mapView():void {
            mediatorMap.mapView(MainView, MainMediator, null, true, true);
            mediatorMap.mapView(LoginView, LoginMediator, null, true, true);
            mediatorMap.mapView(ContentView, ContentMediator, null, true, true);
        }

        private function mapController():void {

        }
    }

}
